﻿
using Lamex.Base;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Lamex.SystemManager.Model
{
	/// <summary>
	/// 机构（部门）信息
	/// </summary>
    [DataContract]
    [KnownType("GetKnowTypes")]
    [Serializable]
    [Table(TableName = "Sys_OrgStucture", KeyName = "ID", OutoKeyValue = "ID", sortIndex = "CreateTime")]
	public partial class tb_OrgStuctureInfo
	{
		
		#region Model
		private int _id;
		private int _pid=-1;
		private string _handno;
		private string _name;
		private string _sortcode;
		private string _category;
		private string _address;
		private string _outerphone;
		private string _innerphone;
		private string _note;
		private string _creator;
		private string _creator_id;
		private DateTime? _createtime= DateTime.Now;
		private string _editor;
		private string _editor_id;
		private DateTime? _edittime= DateTime.Now;
		private bool _deleted;
        private bool _enabled;
		private string _company_id;
		private string _companyname;
		/// <summary>
		/// 
		/// </summary>
        [DataMember]
		public int ID
		{
			set{ _id=value;}
			get{return _id;}
		}
		/// <summary>
		/// 父ID
		/// </summary>
        [DataMember]
		public int PID
		{
			set{ _pid=value;}
			get{return _pid;}
		}
		/// <summary>
		/// 机构编码
		/// </summary>
        [DataMember]
		public string HandNo
		{
			set{ _handno=value;}
			get{return _handno;}
		}
        /// <summary>
        /// 机构名称
        /// </summary>
        [DataMember]
        public string Name
		{
			set{ _name=value;}
			get{return _name;}
		}
		/// <summary>
		/// 排序码
		/// </summary>
        [DataMember]
		public string SortCode
		{
			set{ _sortcode=value;}
			get{return _sortcode;}
		}
		/// <summary>
		/// 机构分类
		/// </summary>
        [DataMember]
		public string Category
		{
			set{ _category=value;}
			get{return _category;}
		}
		/// <summary>
		/// 机构地址
		/// </summary>
        [DataMember]
		public string Address
		{
			set{ _address=value;}
			get{return _address;}
		}
		/// <summary>
		/// 外线电话
		/// </summary>
        [DataMember]
		public string OuterPhone
		{
			set{ _outerphone=value;}
			get{return _outerphone;}
		}
		/// <summary>
		/// 内线电话
		/// </summary>
        [DataMember]
		public string InnerPhone
		{
			set{ _innerphone=value;}
			get{return _innerphone;}
		}
		/// <summary>
		/// 备注
		/// </summary>
        [DataMember]
		public string Note
		{
			set{ _note=value;}
			get{return _note;}
		}
		/// <summary>
		/// 创建人
		/// </summary>
        [DataMember]
		public string Creator
		{
			set{ _creator=value;}
			get{return _creator;}
		}
		/// <summary>
		/// 创建人ID
		/// </summary>
        [DataMember]
		public string Creator_ID
		{
			set{ _creator_id=value;}
			get{return _creator_id;}
		}
		/// <summary>
		/// 创建时间
		/// </summary>
        [DataMember]
		public DateTime? CreateTime
		{
			set{ _createtime=value;}
			get{return _createtime;}
		}
		/// <summary>
		/// 编辑人
		/// </summary>
        [DataMember]
		public string Editor
		{
			set{ _editor=value;}
			get{return _editor;}
		}
		/// <summary>
		/// 编辑人ID
		/// </summary>
        [DataMember]
		public string Editor_ID
		{
			set{ _editor_id=value;}
			get{return _editor_id;}
		}
		/// <summary>
		/// 编辑时间
		/// </summary>
        [DataMember]
		public DateTime? EditTime
		{
			set{ _edittime=value;}
			get{return _edittime;}
		}
		/// <summary>
		/// 是否已删除
		/// </summary>
        [DataMember]
        public bool Deleted
		{
			set{ _deleted=value;}
			get{return _deleted;}
		}
		/// <summary>
		/// 有效标志
		/// </summary>
        [DataMember]
        public bool Enabled
		{
			set{ _enabled=value;}
			get{return _enabled;}
		}
		/// <summary>
		/// 所属公司ID
		/// </summary>
        [DataMember]
		public string Company_ID
		{
			set{ _company_id=value;}
			get{return _company_id;}
		}
		/// <summary>
		/// 所属公司名称
		/// </summary>
        [DataMember]
		public string CompanyName
		{
			set{ _companyname=value;}
			get{return _companyname;}
		}
		#endregion Model

	}

    /// <summary>
    /// 部门机构节点对象
    /// </summary>
    [Serializable]
    [DataContract]
    public class OUNodeInfo : tb_OrgStuctureInfo
    {
        private List<OUNodeInfo> m_Children = new List<OUNodeInfo>();

        /// <summary>
        /// 子机构实体类对象集合
        /// </summary>
        [DataMember]
        public List<OUNodeInfo> Children
        {
            get { return m_Children; }
            set { m_Children = value; }
        }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        public OUNodeInfo()
        {
            this.m_Children = new List<OUNodeInfo>();
        }

        /// <summary>
        /// 参数构造函数
        /// </summary>
        /// <param name="info">OUInfo对象</param>
        public OUNodeInfo(tb_OrgStuctureInfo info)
        {
            base.ID = info.ID;
            base.PID = info.PID;
            base.HandNo = info.HandNo;
            base.Name = info.Name;
            base.SortCode = info.SortCode;
            base.Category = info.Category;
            base.Address = info.Address;
            base.OuterPhone = info.OuterPhone;
            base.InnerPhone = info.InnerPhone;
            base.Note = info.Note;
            base.Creator = info.Creator;
            base.Creator_ID = info.Creator_ID;
            base.CreateTime = info.CreateTime;
            base.Editor = info.Editor;
            base.Editor_ID = info.Editor_ID;
            base.EditTime = info.EditTime;
            base.Deleted = info.Deleted;
            base.Enabled = info.Enabled;
            base.Company_ID = info.Company_ID;
            base.CompanyName = info.CompanyName;
        }
    }
}

